import { createRouter, createWebHistory } from 'vue-router'

const routes = [
  {
    path: '/',
    name: 'Layout',
    component: () => import('@/layout/index.vue'),
    children: [
      {
        path: '',
        name: 'Dashboard',
        component: () => import('@/views/dashboard/index.vue'),
        meta: { title: '仪表盘' }
      },
      {
        path: 'projects',
        name: 'Projects',
        component: () => import('@/views/projects/index.vue'),
        meta: { title: '项目管理' }
      },
      {
        path: 'projects/detail/:id',
        name: 'ProjectDetail',
        component: () => import('@/views/projects/components/ProjectDetail.vue'),
        meta: { title: '项目详情' }
      },
      {
        path: 'tasks',
        name: 'Tasks',
        component: () => import('@/views/tasks/index.vue'),
        meta: { title: '任务管理' }
      },
      {
        path: 'gantt',
        name: 'Gantt',
        component: () => import('@/views/gantt/index.vue'),
        meta: { title: '进度协同' }
      },
      {
        path: 'tracking',
        name: 'Tracking',
        component: () => import('@/views/tracking/index.vue'),
        meta: { title: '进度跟踪' }
      },
      {
        path: 'statistics',
        name: 'Statistics',
        component: () => import('@/views/statistics/index.vue'),
        meta: { title: '统计分析' }
      },
      {
        path: 'users',
        name: 'Users',
        component: () => import('@/views/users/index.vue'),
        meta: { title: '用户管理' }
      },
      {
        path: 'roles',
        name: 'Roles',
        component: () => import('@/views/users/roles.vue'),
        meta: { title: '角色权限' }
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router 